home *** CD-ROM | disk | FTP | other *** search
/ CYBER.XPO.95 / CYBER.XPO.95 (Arsenal Computer).ISO / popreq / amiga1 / anostool.lha / Announcer.rx < prev    next >
Text File  |  1993-12-05  |  3KB  |  131 lines

  1. /* Announcer version 19931205 */
  2. /* AREXX program to scan AmigaNOS smtp mail and act on it */
  3. /* Announcer.rx is Copyright ⌐ 1993 by Dan Roman */
  4.  
  5. /* Edit the following lines for your system */
  6. /********************************************/
  7.  
  8. mailfile='uumail:robot.txt'                    /* user mail file to use */
  9. modemport='SER:'                            /* port modem is connect to */
  10. modemstring='ATDT5551212'                    /* dial string for modem */
  11. modemringdelay=300                            /* delay before hang up */
  12. beeperstring='ATDT5551234@44**64**0**158##'    /* dial and beeper string for modem */
  13. beeperdelay=1200                            /* delay before hang up */
  14.  
  15. /********************************************/
  16.  
  17. if ~show('L',"rexxsupport.library") then do
  18.     call addlib('rexxsupport.library',0,-30,0)
  19. end
  20.  
  21. signal on BREAK_C
  22.  
  23. if ~open(mailin,mailfile,'R') then exit 0
  24. if ~open(log,'TCPIP:Announcer.log','A') then call open(log,'TCPIP:Announcer.log','W')
  25.  
  26. do while ~eof(mailin)
  27.     line=readln(mailin)
  28.     if upper(left(line,6))=='FROM: ' then do
  29.         writech(log,date()||' '||time()||' -- ')
  30.         writeln(log,line)
  31.         from=right(line,length(line)-6)
  32.     end
  33.     if upper(left(line,9))=='SUBJECT: ' then do
  34.         line=right(line,length(line)-9)
  35.         writech(log,'   Command: '||line||' ** Status: ')
  36.         select
  37.             when upper(left(strip(line,'L'),3))=='RUN' then do
  38.                 if open(cmdfile,'TCPIP:Announcer.commands','R') then do
  39.                     parse var line cmd pgm .
  40.                     do while ~eof(cmdfile)
  41.                         if upper(pgm)==upper(readln(cmdfile)) then do
  42.                             address command line
  43.                             writeln(log,'Ok')
  44.                             break
  45.                         end
  46.                     end
  47.                 end
  48.                 else writeln(log,'Error opening command file.')
  49.             end
  50.  
  51.             when upper(strip(line))=='PHONEHOME' then do
  52.                 if ~open(mdm,modemport,'W') then do
  53.                     writeln(log,'Error opening modem port '||modemport)
  54.                     end
  55.                 else do
  56.                     call delay(60)
  57.                     writech(mdm,modemstring||d2c(13))
  58.                     call delay(modemringdelay)
  59.                     writech(mdm,d2c(13))
  60.                     call delay(60)
  61.                     close(mdm)
  62.                     writeln(log,'Ok')
  63.                     end
  64.             end
  65.  
  66.             when upper(strip(line))=='BEEPER' then do
  67.                 if ~open(mdm,modemport,'W') then do
  68.                     writeln(log,'Error opening modem port '||modemport)
  69.                     end
  70.                 else do
  71.                     call delay(60)
  72.                     writech(mdm,beeperstring||d2c(13))
  73.                     call delay(beeperdelay)
  74.                     writech(mdm,d2c(13))
  75.                     call delay(60)
  76.                     writech(mdm,'ATH0'||d2c(13))
  77.                     call delay(60)
  78.                     close(mdm)
  79.                     writeln(log,'Ok')
  80.                     end
  81.             end
  82.  
  83.             when upper(strip(line))=='PAGEMESSAGE' then do
  84.                 do while ~eof(mailin)&length(strip(line))>0
  85.                     line=readln(mailin)
  86.                 end
  87.                 if open(talker,'SPEAK:','W') then do
  88.                     i=0
  89.                     do while ~eof(mailin)&upper(line)~='[START]'
  90.                         line=readln(mailin)
  91.                     end
  92.                     do while ~eof(mailin)&upper(line)~='[END]'
  93.                         line=readln(mailin)
  94.                         writeln(talker,line)
  95.                         i=i+1
  96.                     end
  97.                     writeln(log,i||' lines processed')
  98.                     close(talker)
  99.                 end
  100.                 else writeln(log,'Error opening SPEAK:')
  101.             end
  102.  
  103.             when upper(left(strip(line,'L'),4))=='PAGE' then do
  104.                 if open(talker,'SPEAK:','W') then do
  105.                     writeln(log,'Ok')
  106.                     if upper(line)=='PAGE' then do
  107.                         writeln(talker,'Page from')
  108.                         do i=1 to length(from) until substr(from,i+1,1)=='@'
  109.                             writech(talker,substr(from,i,1)||' ')
  110.                         end
  111.                     end
  112.                     else writeln(talker,line)
  113.                     close(talker)
  114.                 end
  115.                 else writeln(log,'Error opening SPEAK:')
  116.             end
  117.  
  118.             otherwise
  119.                 writeln(log,'Invalid Command')
  120.         end
  121.     end
  122. end
  123.  
  124. close(mailin)
  125. call delete(mailfile)
  126. exit 0
  127.  
  128. BREAK_C:
  129.     say "*** User break"
  130.     exit 10
  131.